function top44() {
	var me = this;
	var error = null;
	var top44_request = new XMLHttpRequest();
	var top_44_artists = new Array();
	var top_44_songs = new Array();
	var top_44_albums = new Array();
	var current_top_song = "";
	var current_top_artist = "";
	var current_top_album = "";
	var current_num = "0";
	
	this.getURL = function() {
		return current_top_album;
	}
	
	this.save_top44 = function() {
		for(var c = 0 ; c < 44; c++) {
			options.putValue("artist_" + c, top_44_artists[c]);
			options.putValue("song_" + c, top_44_songs[c]);
			options.putValue("album" + c, top_44_albums[c]);
		}
	}
	
	this.load_top44 = function() {
		for(var c = 0 ; c < 44; c++) {
			top_44_artists[c] = options.getValue("artist_" + c);
			top_44_songs[c] = options.getValue("song_" + c);
			top_44_albums[c] = options.getValue("album" + c);
		}
	}
	
	this.load_top44();
	
	this.update = function() {
		  try {
	    top44_request.open("GET",  "http://www.effectradio.com/top44.php", true);
	    top44_request.setRequestHeader( "If-Modified-Since", options.getValue("date_updated") );
	  } catch (e) {
	    error = "connect error";
	    return;
	  }
	  top44_request.onreadystatechange = this.recieve;
	  try {
			top44_request.send();
	  } catch (e) {
	    error = "FAILED B";
	    return;
	  }
	}

	this.recieve = function() {
	  if (top44_request.readyState != 4) { return; }
	  if (top44_request.status != 200) {
	    error = "State is not 200... this is bad.";
	  }
	  info = top44_request.responseText;
	  info = info.replace(new RegExp( "\\n", "g" ), "" );

	  as = info.match(/<div id="top44Artist">[^<]*<\/div><div id="top44Song">[^<]*<\/div>\s*<div id="top44Album">\s*<img src="\S+"/gi);
	  for(var c = 0 ; c < as.length; c++)
	  {
		temp = as[c].match(/<div id="top44Artist">\s+([^<]*)<\/div><div id="top44Song">\s+([^<]*)<\/div>\s*<div id="top44Album">\s*<img src="(\S+)"/gi);
		top_44_artists[c] = RegExp.$1;
		top_44_songs[c] = RegExp.$2;
		top_44_albums[c] = "http://effectradio.com/" + RegExp.$3;
	  }
		this.save_top44;
		setTimeout(function(){ me.update()}, 86400000);
	}
	
	this.search = function(song_title, artist) {
		this.update();
		if (artist == undefined) {artist = "";}
		if (song_title == undefined) { song_title = "";}
		artist = artist.replace(/[\n\r\t]/g,"");
		song_title = song_title.replace(/[\n\r\t]/g,"");
		/*
		if (!updated) {
			setTimeout(function(){ me.search(song_title, artist)}, 10000);
			return;
		}
		*/
		current_num = 0;
		current_top_song = "";
		current_top_artist = "";
		current_top_album = "";
		for (var c = 0; c < 44; c++) {
			if(top_44_songs[c] == song_title) {
				current_num = c + 1;
				current_top_song = top_44_songs[c];
				current_top_artist = top_44_artists[c];
				current_top_album = top_44_albums[c];
			}
			if(top_44_artists[c] == artist) {
				current_num = c + 1;
				current_top_artist = top_44_artists[c];
				current_top_album = top_44_albums[c];
				}
		}
		return new Array(current_top_song, current_top_artist, current_num);
	}
	
	this.search_song = function(song_title) {
		var top_song;
		song_title = song_title.replace(/[\n\r\t]/g,"");
		if (!updated) {
			setTimeout(function(){ me.search_song(song_title)}, 10000);
			return;
		}
		for (var c = 0; c < 44; c++) {
			top_song = top_44_songs[c];
			if(top_song == song_title) {
				current_num = c + 1;
				current_top_song = top_44_songs[c];
				current_top_artist = top_44_artists[c];
				current_top_album = top_44_albums[c];
				//img.request(top_44_albums[c]);
				//top_artist_label.innerText = "";
				//top_song_label.innerText = "Top 44: Song #" + current_num;
				return;
			}
		}
		current_num = 0;
		current_top_song = "";
		current_top_artist = "";
		current_top_album = "";
		//top_song_label.innerText = "";
		//top_artist_label.innerText = "";
		//album_image.src="stock_images\no_album.png";
	}
	
	this.search_artist = function(artist) {
		var top_artist;
		artist = artist.replace(/[\n\r\t]/g,"");
		if (!updated) {
			setTimeout(function(){ me.search_artist(artist)}, 10000);
			return;
		}
		for (var c = 0; c < 44; c++) {
			top_artist = top_44_artists[c];
			if(top_artist == artist) {
				current_num = c + 1;
				current_top_song = top_44_songs[c];
				current_top_album = top_44_albums[c];
				//current_top_artist = top_44_artists[c];
				//img.request(top_44_albums[c]);
				//top_artist_label.innerText = "Top 44 Artist";
				//top_song_label.innerText = "";
				return;
			}
		}
		//top_song_label.innerText = "";
		//top_artist_label.innerText = "";
		//album_image.src = "stock_images\\no_album.png";
	}
	//this.load_top44();
}
